package Draw;

import Chess.BorderPane;
import javafx.scene.paint.Color;

public class whiteBishop {
	public void whitebishop(int x,int y,int[][] chess){
		int cellent = 90;
		Color color = new Color(0,0,0,0.5);
		for(int i=(x+1),j=(y+1);i<8&&j<8;i++,j++){
			if(chess[j][i]==0){
				BorderPane.gc.setFill(color);
				BorderPane.gc.fillRect(i*cellent, j*cellent, cellent, cellent);	
			}
			else if(chess[j][i]==2){
				BorderPane.gc.setFill(color);
				BorderPane.gc.fillRect(i*cellent, j*cellent, cellent, cellent);
				break;
			}
			else if(chess[j][i]==1){
				break;
			}
		}
		
		for(int i=(x+1),j=(y-1);i<8&&j>=0;i++,j--){
			if(chess[j][i]==0){
				BorderPane.gc.setFill(color);
				BorderPane.gc.fillRect(i*cellent, j*cellent, cellent, cellent);	
			}
			else if(chess[j][i]==2){
				BorderPane.gc.setFill(color);
				BorderPane.gc.fillRect(i*cellent, j*cellent, cellent, cellent);
				break;
			}
			else if(chess[j][i]==1){
				break;
			}
		}
		
		for(int i=(x-1),j=(y+1);i>=0&&j<8;i--,j++){
			if(chess[j][i]==0){
				BorderPane.gc.setFill(color);
				BorderPane.gc.fillRect(i*cellent, j*cellent, cellent, cellent);	
			}
			else if(chess[j][i]==2){
				BorderPane.gc.setFill(color);
				BorderPane.gc.fillRect(i*cellent, j*cellent, cellent, cellent);
				break;
			}
			else if(chess[j][i]==1){
				break;
			}
		}
		
		for(int i=(x-1),j=(y-1);i>=0&&j>=0;i--,j--){
			if(chess[j][i]==0){
				BorderPane.gc.setFill(color);
				BorderPane.gc.fillRect(i*cellent, j*cellent, cellent, cellent);	
			}
			else if(chess[j][i]==2){
				BorderPane.gc.setFill(color);
				BorderPane.gc.fillRect(i*cellent, j*cellent, cellent, cellent);
				break;
			}
			else if(chess[j][i]==1){
				break;
			}
		}
	}
}
